home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / jailbrek.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  11KB  |  316 lines

  1. /***************************************************************************
  2.  
  3. Jailbreak - (c) 1986 Konami
  4.  
  5. Ernesto Corvi
  6. ernesto@imagina.com
  7.  
  8. ***************************************************************************/
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11. #include "cpu/m6809/m6809.h"
  12.  
  13.  
  14. void konami1_decode(void);
  15.  
  16. /* from vidhrdw */
  17. extern unsigned char *jailbrek_scroll_x;
  18. extern int jailbrek_vh_start( void );
  19. extern void jailbrek_vh_stop( void );
  20. extern void jailbrek_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  21. extern void jailbrek_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  22.  
  23. static unsigned char *interrupt_control;
  24.  
  25. static void jailbrek_machine_init( void )
  26. {
  27.     interrupt_control[0] = 0;
  28. }
  29.  
  30. static READ_HANDLER( jailbrek_speech_r ) {
  31.     return ( VLM5030_BSY() ? 1 : 0 );
  32. }
  33.  
  34. static WRITE_HANDLER( jailbrek_speech_w ) {
  35.     VLM5030_VCU( data & 1 );
  36.     VLM5030_ST( ( data >> 1 ) & 1 );
  37.     VLM5030_RST( ( data >> 2 ) & 1 );
  38. }
  39.  
  40. static struct MemoryReadAddress readmem[] =
  41. {
  42.     { 0x0000, 0x07ff, colorram_r },
  43.     { 0x0800, 0x0fff, videoram_r },
  44.     { 0x1000, 0x10bf, MRA_RAM }, /* sprites */
  45.     { 0x10c0, 0x14ff, MRA_RAM }, /* ??? */
  46.     { 0x1500, 0x1fff, MRA_RAM }, /* work ram */
  47.     { 0x2000, 0x203f, MRA_RAM }, /* scroll registers */
  48.     { 0x3000, 0x307f, MRA_NOP }, /* related to sprites? */
  49.     { 0x3100, 0x3100, input_port_1_r }, /* DSW1 */
  50.     { 0x3200, 0x3200, MRA_NOP }, /* ??? */
  51.     { 0x3300, 0x3300, input_port_2_r }, /* coins, start */
  52.     { 0x3301, 0x3301, input_port_3_r }, /* joy1 */
  53.     { 0x3302, 0x3302, input_port_4_r }, /* joy2 */
  54.     { 0x3303, 0x3303, input_port_0_r }, /* DSW0 */
  55.     { 0x6000, 0x6000, jailbrek_speech_r },
  56.     { 0x8000, 0xffff, MRA_ROM },
  57.     { -1 }  /* end of table */
  58. };
  59.  
  60. static struct MemoryWriteAddress writemem[] =
  61. {
  62.     { 0x0000, 0x07ff, colorram_w, &colorram },
  63.     { 0x0800, 0x0fff, videoram_w, &videoram, &videoram_size },
  64.     { 0x1000, 0x10bf, MWA_RAM, &spriteram, &spriteram_size }, /* sprites */
  65.     { 0x10c0, 0x14ff, MWA_RAM }, /* ??? */
  66.     { 0x1500, 0x1fff, MWA_RAM }, /* work ram */
  67.     { 0x2000, 0x203f, MWA_RAM, &jailbrek_scroll_x }, /* scroll registers */
  68.     { 0x2043, 0x2043, MWA_NOP }, /* ??? */
  69.     { 0x2044, 0x2044, MWA_RAM, &interrupt_control }, /* irq, nmi enable, bit3 = cocktail mode? */
  70.     { 0x3000, 0x307f, MWA_RAM }, /* ??? */
  71.     { 0x3100, 0x3100, SN76496_0_w }, /* SN76496 data write */
  72.     { 0x3200, 0x3200, MWA_NOP },    /* mirror of the previous? */
  73.     { 0x3300, 0x3300, watchdog_reset_w }, /* watchdog */
  74.     { 0x4000, 0x4000, jailbrek_speech_w }, /* speech pins */
  75.     { 0x5000, 0x5000, VLM5030_data_w }, /* speech data */
  76.     { 0x8000, 0xffff, MWA_ROM },
  77.     { -1 }  /* end of table */
  78. };
  79.  
  80. INPUT_PORTS_START( jailbrek )
  81.     PORT_START    /* DSW0  - $3303 */
  82.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  83.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  84.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  85.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  86.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  87.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  88.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  89.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  90.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  91.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  92.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  93.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  94.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  95.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  96.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  97.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  98.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  99.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  100.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  101.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  102.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  103.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  104.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  105.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  106.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  107.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  108.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  109.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  110.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  111.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  112.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  113.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  114.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  115.     PORT_DIPSETTING(    0x00, "Invalid?" )
  116.  
  117.     PORT_START    /* DSW1  - $3100 */
  118.     PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
  119.     PORT_DIPSETTING(    0x03, "1" )
  120.     PORT_DIPSETTING(    0x02, "2" )
  121.     PORT_DIPSETTING(    0x01, "3" )
  122.     PORT_DIPSETTING(    0x00, "5" )
  123.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  124.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  125.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  126.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
  127.     PORT_DIPSETTING(    0x08, "30000 70000" )
  128.     PORT_DIPSETTING(    0x00, "40000 80000" )
  129.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  130.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  131.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  132.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  133.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  134.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  135.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  136.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  137.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  138.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  139.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  140.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  141.  
  142.     PORT_START    /* IN0 - $3300 */
  143.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  144.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  145.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  146.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  147.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  148.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  149.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  150.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  151.  
  152.     PORT_START    /* IN1 - $3301 */
  153.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
  154.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
  155.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
  156.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
  157.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  158.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  159.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  160.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  161.  
  162.     PORT_START    /* IN2 - $3302 */
  163.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
  164.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  165.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
  166.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
  167.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  168.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  169.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  170.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  171. INPUT_PORTS_END
  172.  
  173. static struct GfxLayout charlayout =
  174. {
  175.     8,8,    /* 8*8 characters */
  176.     1024,    /* 1024 characters */
  177.     4,    /* 4 bits per pixel */
  178.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  179.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  180.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  181.     32*8    /* every char takes 32 consecutive bytes */
  182. };
  183.  
  184. static struct GfxLayout spritelayout =
  185. {
  186.     16,16,    /* 16*16 sprites */
  187.     512,    /* 512 sprites */
  188.     4,    /* 4 bits per pixel */
  189.     { 0, 1, 2, 3 },    /* the bitplanes are packed in one nibble */
  190.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
  191.             32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
  192.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  193.             16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
  194.     128*8    /* every sprite takes 128 consecutive bytes */
  195. };
  196.  
  197. static struct GfxDecodeInfo gfxdecodeinfo[] =
  198. {
  199.     { REGION_GFX1, 0, &charlayout,   0, 16 }, /* characters */
  200.     { REGION_GFX2, 0, &spritelayout, 16*16, 16 }, /* sprites */
  201.     { -1 } /* end of array */
  202. };
  203.  
  204. static int jb_interrupt( void ) {
  205.     if ( interrupt_control[0] & 2 )
  206.         return interrupt();
  207.  
  208.     return ignore_interrupt();
  209. }
  210.  
  211. static int jb_interrupt_nmi( void ) {
  212.     if ( interrupt_control[0] & 1 )
  213.         return nmi_interrupt();
  214.  
  215.     return ignore_interrupt();
  216. }
  217.  
  218. static struct SN76496interface sn76496_interface =
  219. {
  220.     1,    /* 1 chip */
  221.     { 1500000 },    /*  1.5 MHz ? (hand tuned) */
  222.     { 100 }
  223. };
  224.  
  225. static struct VLM5030interface vlm5030_interface =
  226. {
  227.     3580000,    /* master clock */
  228.     100,        /* volume       */
  229.     REGION_SOUND1,    /* memory region of speech rom */
  230.     0,          /* memory size of speech rom */
  231.     0           /* VCU pin level (default)     */
  232. };
  233.  
  234. static struct MachineDriver machine_driver_jailbrek =
  235. {
  236.     /* basic machine hardware */
  237.     {
  238.         {
  239.             CPU_M6809,
  240.             3000000,        /* 3 Mhz ??? */
  241.             readmem,writemem,0,0,
  242.             jb_interrupt,1,
  243.             jb_interrupt_nmi, 500 /* ? */
  244.         }
  245.     },
  246.     60, DEFAULT_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  247.     1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  248.     jailbrek_machine_init,
  249.  
  250.     /* video hardware */
  251.     32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
  252.     gfxdecodeinfo,
  253.     32,512,
  254.     jailbrek_vh_convert_color_prom,
  255.  
  256.     VIDEO_TYPE_RASTER,
  257.     0,
  258.     jailbrek_vh_start,
  259.     generic_vh_stop,
  260.     jailbrek_vh_screenrefresh,
  261.  
  262.     /* sound hardware */
  263.     0,0,0,0,
  264.     {
  265.         {
  266.             SOUND_SN76496,
  267.             &sn76496_interface
  268.         },
  269.         {
  270.             SOUND_VLM5030,
  271.             &vlm5030_interface
  272.         }
  273.     }
  274. };
  275.  
  276.  
  277. /***************************************************************************
  278.  
  279.   Game driver(s)
  280.  
  281. ***************************************************************************/
  282.  
  283. ROM_START( jailbrek )
  284.     ROM_REGION( 2*0x10000, REGION_CPU1 )     /* 64k for code + 64k for decrypted opcodes */
  285.     ROM_LOAD( "jailb11d.bin", 0x8000, 0x4000, 0xa0b88dfd )
  286.     ROM_LOAD( "jailb9d.bin",  0xc000, 0x4000, 0x444b7d8e )
  287.  
  288.     ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  289.     ROM_LOAD( "jailb4f.bin",  0x00000, 0x4000, 0xe3b7a226 )    /* characters */
  290.     ROM_LOAD( "jailb5f.bin",  0x04000, 0x4000, 0x504f0912 )
  291.  
  292.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  293.     ROM_LOAD( "jailb3e.bin",  0x00000, 0x4000, 0x0d269524 )    /* sprites */
  294.     ROM_LOAD( "jailb4e.bin",  0x04000, 0x4000, 0x27d4f6f4 )
  295.     ROM_LOAD( "jailb5e.bin",  0x08000, 0x4000, 0x717485cb )
  296.     ROM_LOAD( "jailb3f.bin",  0x0c000, 0x4000, 0xe933086f )
  297.  
  298.     ROM_REGION( 0x0240, REGION_PROMS )
  299.     ROM_LOAD( "jailbbl.cl2",  0x0000, 0x0020, 0xf1909605 ) /* red & green */
  300.     ROM_LOAD( "jailbbl.cl1",  0x0020, 0x0020, 0xf70bb122 ) /* blue */
  301.     ROM_LOAD( "jailbbl.bp2",  0x0040, 0x0100, 0xd4fe5c97 ) /* char lookup */
  302.     ROM_LOAD( "jailbbl.bp1",  0x0140, 0x0100, 0x0266c7db ) /* sprites lookup */
  303.  
  304.     ROM_REGION( 0x4000, REGION_SOUND1 ) /* speech rom */
  305.     ROM_LOAD( "jailb8c.bin",  0x0000, 0x2000, 0xd91d15e3 )
  306. ROM_END
  307.  
  308.  
  309. static void init_jailbrek(void)
  310. {
  311.     konami1_decode();
  312. }
  313.  
  314.  
  315. GAMEX( 1986, jailbrek, 0, jailbrek, jailbrek, jailbrek, ROT0, "Konami", "Jail Break", GAME_NO_COCKTAIL )
  316.